function exp_runtime_datasize_SLICE2()
    h=figure(1);
    runtimes_c3 =zeros(10,1);
    runtimes_c4 =zeros(10,1);
    runtimes_c5 =zeros(10,1);
    numpoints = zeros(10,1);
    for i=1:10
        numpoints(i)=i*100;
    end
    for i=1:10
        data=DATAF3C3(numpoints(i));
        runtimes_c3(i)=SLICE2_F3(data);        
    end
    for i=1:10
        data=DATAF3C4(numpoints(i));
        runtimes_c4(i)=SLICE2_F3(data);        
    end
    for i=1:10
        data=DATAF3C5(numpoints(i));
        runtimes_c5(i)=SLICE2_F3(data);        
    end
    runtimes=[runtimes_c3,runtimes_c4,runtimes_c5];
    save('exp_runtime_datasize_SLICE2.mat','numpoints','runtimes');
    plot(numpoints, runtimes_c3, 'b-+');
    hold on;
    plot(numpoints, runtimes_c4, 'r-*');
    hold on;
    plot(numpoints, runtimes_c5,'g-o');
    hold on;
    saveas(h, 'figure_exp_runtime_datasize_SLICE2.fig');
end


function [runtime]=SLICE2_F3(data)
    runtime=0;
    tic;
    [corrplanes,sups]=SLICE2(data,1,0.000001,0.08);
    runtime=toc;
    corratts={};
    for i=1:length(corrplanes)
        corratts{i}=[1,2,3];
    end
    displaycorrelations(corrplanes,sups,corratts,0.001, 'exp_SLICE.txt');
end

function data=DATAF3C3(numpoints)
    nosie_numpoints = int32(numpoints/4);
    numpoints=int32((numpoints-nosie_numpoints)/3);
    noise_x=randint(1,nosie_numpoints,[-200,200]);
    noise_y=randint(1,nosie_numpoints,[-200,200]);
    noise_z=randint(1,nosie_numpoints,[-200,200]);
    
    x1=randint(1,numpoints,[-200,200]);
    y1=randint(1,numpoints,[-200,200]);
    z1=2*x1+y1; % 2x1+x2-x3=0
    
    x2=randint(1,numpoints,[-200,200]);
    y2=randint(1,numpoints,[-200,200]);
    z2=x2*3-y2*5+randn(1,numpoints); % 3x1-5x2-x3=0
    
    x3=randint(1,numpoints,[-200,200]);
    y3=randint(1,numpoints,[-200,200]);
    z3=-4*x3-2*y3+100+randn(1,numpoints); % 4x1+2x2+x3=100
    
    x=[noise_x,x1,x2,x3];
    y=[noise_y,y1,y2,y3];
    z=[noise_z,z1,z2,z3];
    data=[ x',y',z'];
end

function data=DATAF3C4(numpoints)
    nosie_numpoints = int32(numpoints/5);
    numpoints=int32((numpoints-nosie_numpoints)/4);
    noise_x=randint(1,nosie_numpoints,[-200,200]);
    noise_y=randint(1,nosie_numpoints,[-200,200]);
    noise_z=randint(1,nosie_numpoints,[-200,200]);
    
    x1=randint(1,numpoints,[-200,200]);
    y1=randint(1,numpoints,[-200,200]);
    z1=2*x1+y1; % 2x1+x2-x3=0
    
    x2=randint(1,numpoints,[-200,200]);
    y2=randint(1,numpoints,[-200,200]);
    z2=x2*3-y2*5+randn(1,numpoints); % 3x1-5x2-x3=0
    
    x3=randint(1,numpoints,[-200,200]);
    y3=randint(1,numpoints,[-200,200]);
    z3=-4*x3-2*y3+100+randn(1,numpoints); % 4x1+2x2+x3=100
    
    x4=randint(1,numpoints,[-200,200]);
    y4=randint(1,numpoints,[-200,200]);
    z4=4*x4+y4+200+randn(1,numpoints); % 4x1+x2-x3=-200
    
    x=[noise_x,x1,x2,x3,x4];
    y=[noise_y,y1,y2,y3,y4];
    z=[noise_z,z1,z2,z3,z4];
    data=[ x',y',z'];
end

function data=DATAF3C5(numpoints)
    nosie_numpoints = int32(numpoints/6);
    numpoints=int32((numpoints-nosie_numpoints)/5);
    noise_x=randint(1,nosie_numpoints,[-200,200]);
    noise_y=randint(1,nosie_numpoints,[-200,200]);
    noise_z=randint(1,nosie_numpoints,[-200,200]);
    
    x1=randint(1,numpoints,[-200,200]);
    y1=randint(1,numpoints,[-200,200]);
    z1=2*x1+y1; % 2x1+x2-x3=0
    
    x2=randint(1,numpoints,[-200,200]);
    y2=randint(1,numpoints,[-200,200]);
    z2=x2*3-y2*5+randn(1,numpoints); % 3x1-5x2-x3=0
    
    x3=randint(1,numpoints,[-200,200]);
    y3=randint(1,numpoints,[-200,200]);
    z3=-4*x3-2*y3+100+randn(1,numpoints); % 4x1+2x2+x3=100
    
    x4=randint(1,numpoints,[-200,200]);
    y4=randint(1,numpoints,[-200,200]);
    z4=4*x4+y3+200+randn(1,numpoints); % 4x1+x2-x3=-200
    
    x5=randint(1,numpoints,[-200,200]);
    y5=randint(1,numpoints,[-200,200]);
    z5=0.4*x5+3*y5-150+randn(1,numpoints); % 0.4x1+3x2-x3=150
    
    x=[noise_x,x1,x2,x3,x4,x5];
    y=[noise_y,y1,y2,y3,y4,y5];
    z=[noise_z,z1,z2,z3,z4,z5];
    data=[ x',y',z'];
end

